//
//  BaseView.m
//
//  Created by BruceYu on 15/3/18.
//  Copyright (c) 2015年 BruceYu. All rights reserved.
//

#import "BaseView.h"


@implementation BaseView
-(void)dealloc{
    NSLog(@"%@ 这个类被强暴了",NSStringFromClass([self class]));
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.opaque = YES;
        self.translatesAutoresizingMaskIntoConstraints = NO;
    }
    return self;
}

-(void)onMainSetSubViewFrame:(void(^)(UIView *view,CGPoint origin,CGSize size,CGPoint center))layoutBlock
{
    if (layoutBlock !=_layoutBlock) {
        _layoutBlock = layoutBlock;
    }
    
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    CGRect frame = self.frame;
    if (_layoutBlock) {
        _layoutBlock(self,frame.origin,frame.size,self.center);
    }
    
}
@end


@implementation BaseControl
-(void)dealloc{
    NSLog(@"%@ 这个类被强暴了",NSStringFromClass([self class]));
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.opaque = YES;
        self.translatesAutoresizingMaskIntoConstraints = NO;
    }
    return self;
}

-(void)onMainSetSubViewFrame:(void(^)(UIView *view,CGPoint origin,CGSize size,CGPoint center))layoutBlock
{
    if (layoutBlock !=_layoutBlock) {
        _layoutBlock = layoutBlock;
    }
    
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    CGRect frame = self.frame;
    if (_layoutBlock) {
        _layoutBlock(self,frame.origin,frame.size,self.center);
    }
    
}
@end
